<?xml version="1.0" ?>

<xsl:stylesheet   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                  xmlns:xs="http://www.w3.org/2001/XMLSchema" 
                  xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
                  xmlns:lzc="http://schemas.icitadel.com/Lazarus/Compiled.xsd"
                  version="1.0">

	<xsl:output method="xml"/>

	<xsl:include href="../../common.xsl" />
	<xsl:include href="../../convert.xsl" />

   <xsl:template match="lzc:project">
      <xsl:apply-templates select="//lzc:method[ @compiling ]" />
   </xsl:template>

   <xsl:template match="lzc:method">
      <xs:schema id="root" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
         <xs:element name="root" msdata:IsDataSet="true">
            <xs:complexType>
               <xs:choice maxOccurs="unbounded">
                  <xs:element>
							<xsl:attribute name="name"><xsl:value-of select="ancestor::lzc:table/@name"/></xsl:attribute>
                     <xs:complexType>
                        <xsl:for-each select=".//lzc:method-result">
                           <xs:attribute>
                              <xsl:variable name="CurrentField" select="." />
                              <xsl:variable name="ObjectField" select="ancestor::lzc:object/lzc:fields/lzc:field[ @name = $CurrentField/@name ]" />
                              <xsl:attribute name="name"><xsl:value-of select="@alias" /></xsl:attribute>
                              <xsl:attribute name="type">
											<xsl:call-template name="getXSLType">
												<xsl:with-param name="pFieldType" select="@type" />
											</xsl:call-template>
										</xsl:attribute>
                           </xs:attribute>
                        </xsl:for-each>
                     </xs:complexType>
                  </xs:element>
               </xs:choice>
            </xs:complexType>
         </xs:element>
      </xs:schema>
   </xsl:template>
   
</xsl:stylesheet>